package com.qf.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.qf.mapper.DtsGrouponRulesMapper;
import com.qf.pojo.DtsGroupon;
import com.qf.pojo.DtsGrouponRules;
import com.qf.service.DtsGrouponRulesService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @author Zwnan
 */
@Service
public class DtsGrouponRulesServiceImpl implements DtsGrouponRulesService {
    @Autowired
    private DtsGrouponRulesMapper dtsGrouponRulesMapper;
    @Override
    public IPage<DtsGrouponRules> selectPage(Integer page, Integer limit, String sort, String order) {
        IPage<DtsGrouponRules> iPage = new Page<>();
        return dtsGrouponRulesMapper.selectPage(iPage,new QueryWrapper<DtsGrouponRules>().eq("deleted", false));
    }

    @Override
    public void insert(DtsGrouponRules dtsGrouponRules) {
        dtsGrouponRulesMapper.insert(dtsGrouponRules);
    }

    @Override
    public void update(DtsGrouponRules dtsGrouponRules) {
        dtsGrouponRulesMapper.updateById(dtsGrouponRules);
    }

    @Override
    public void delete(DtsGrouponRules dtsGrouponRules) {
        dtsGrouponRules.setDeleted(true);
        dtsGrouponRulesMapper.updateById(dtsGrouponRules);
    }
}
